package com.xoa.controller.party;

import com.xoa.model.party.PartyMeetingRecords;
import com.xoa.model.party.PartyMeetingRecordsWithBLOBs;
import com.xoa.service.party.PartyMeetingRecordsService;
import com.xoa.util.ToJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * 党会记录接口
 * Created by 杨岩林 on 2019-04-30.
 */
@Controller
@RequestMapping("partyMeetingRecords")
public class PartyMeetingRecordsController {

    @Autowired
    private PartyMeetingRecordsService partyMeetingRecordsService;

    //党会记录页面映射
    @RequestMapping("/partyMeeting")
    public String partyMeeting(HttpServletRequest request) {
        /*Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);*/
        return "app/partyMeeting/partyMeetingIndex";
    }
    //党会记录管理页面映射
    @RequestMapping("/partyMeetingStraff")
    public String partyMeetingStraff(HttpServletRequest request) {
        /*Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);*/
        return "app/partyMeeting/partyMeetingStraff";
    }
    //新增党会记录页面映射
    @RequestMapping("/partyMeetingNew")
    public String partyMeetingNew(HttpServletRequest request) {
        /*Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);*/
        return "app/partyMeeting/partyMeetingNew";
    }
    //党会记录信息页面映射
    @RequestMapping("/partyMeetingQuery")
    public String partyMeetingQuery(HttpServletRequest request) {
        /*Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);*/
        return "app/partyMeeting/partyMeetingQuery";
    }

    //党会记录详情页面映射
    @RequestMapping("/partyMeetingDetil")
    public String partyMeetingDetil(HttpServletRequest request) {
        /*Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);*/
        return "app/partyMeeting/partyMeetingDetil";
    }

//党会记录数据列表接口
    @RequestMapping("showAll")
    @ResponseBody
    public ToJson showAll(PartyMeetingRecordsWithBLOBs partyMeetingRecordsWithBLOBs, Integer page, Integer pageSize, boolean userFlag){
        return partyMeetingRecordsService.findAll(partyMeetingRecordsWithBLOBs,page,pageSize,userFlag);
    }

    //党会记录增加接口
    @RequestMapping("add")
    @ResponseBody
    public ToJson add(PartyMeetingRecordsWithBLOBs partyMeetingRecordsWithBLOBs){
        return partyMeetingRecordsService.add(partyMeetingRecordsWithBLOBs);
    }

    //党会记录删除接口
    @RequestMapping("delete")
    @ResponseBody
    public ToJson delete(Integer id){
        return  partyMeetingRecordsService.delete(id);
    }

    //根据id查询接口
    @RequestMapping("queryOne")
    @ResponseBody
    public PartyMeetingRecords queryOne(Integer id){
        return partyMeetingRecordsService.findOne(id);
    }

    //党会记录修改接口
    @RequestMapping("update")
    @ResponseBody
    public ToJson update(PartyMeetingRecordsWithBLOBs partyMeetingRecordsWithBLOBs){
        return partyMeetingRecordsService.update(partyMeetingRecordsWithBLOBs);
    }
}
